#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
int main()
{
    
    set<char> myset;
    string s;
    cin>>s;
    for(auto e: s)
        myset.insert(e);
    string s1;
    for(auto e: myset)
        s1.push_back(e);
    sort(s1.begin(),s1.end(),[](char a,char b){
        return a>b;
    });
    //cout<<s1;
    string s2;
    for(auto e: s)
    {
        int pos = s1.find(e);
        s2.push_back(pos + '0');
    }
    //cout<<s2;
    cout<<"int[] arr = new int[]{";
    int i;
    for(i = 0; i<s1.size()-1; i++)
        cout<<s1[i]<<",";
    cout<<s1[i]<<"};"<<endl;
    
    cout<<"int[] index = new int[]{";
   
    for(i = 0; i<s2.size()-1; i++)
        cout<<s2[i]<<",";
    cout<<s2[i]<<"};";
        
}